package com.zhuss.controller.core;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.zhuss.bean.bo.core.config.CreateConfigBo;
import com.zhuss.bean.bo.core.config.DecrConfigSortBo;
import com.zhuss.bean.bo.core.config.DeleteConfigBo;
import com.zhuss.bean.bo.core.config.IncrConfigSortBo;
import com.zhuss.bean.bo.core.config.UpdateConfigBo;
import com.zhuss.common.BaseController;
import com.zhuss.common.OperateService;
import com.zhuss.core.config.ConfigOperateServiceExt;
import com.zhuss.exception.AabException;


/**
 * 配置操作 controller
 * @Author zhushanshuo
   @Date 2020-02-20 11:58
 *
 */
  
 
@RestController
@RequestMapping("/config")
public class ConfigOperateController extends BaseController {
	
	@Autowired
	@Qualifier("configOperateService")
	private OperateService<Void, Object> configOperateService;
	
	@Autowired
	@Qualifier("configOperateServiceExt")
	private ConfigOperateServiceExt configOperateServiceExt;
	
	/**
	 * 创建
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/create")
    public void create(@RequestBody CreateConfigBo bo) throws AabException {
		
		configOperateService.create(bo);
    }
	
	
	/**
	 * 修改
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/update")
    public void update(@RequestBody UpdateConfigBo bo) throws AabException {
		
		configOperateService.update(bo);
    }
	
	/**
	 * 删除
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/delete")
    public void delete(@RequestBody DeleteConfigBo bo) throws AabException {
		
		configOperateService.delete(bo);
    }
	
	/**
	 * 上移
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/incrSort")
    public void incrSort(@RequestBody IncrConfigSortBo bo) throws AabException {
		
		configOperateServiceExt.incrSort(bo);
    }
	
	/**
	 * 下移
	 * @param bo
	 * @throws AabException
	 */
	@ResponseBody
    @PostMapping("/decrSort")
    public void decrSort(@RequestBody DecrConfigSortBo bo) throws AabException {
		
		configOperateServiceExt.decrSort(bo);
    }

	
}
